let res = '[abc[bcd[def]]]'.match(/\w+/g)

let res2 = '[abc[bcd[def]]]'.replace(/\w+/g, (...ags) => {
    // console.log('res2:', ags)
    return ags[1]
})

let res3 = new RegExp('\\w+', 'g').exec('[abc[bcd[def]]]');
console.log(res3);